package cn.com.nr.service.impl;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import cn.com.nr.mapper.NrRecordsMapper;
import cn.com.nr.entity.NrRecordsEntity;
import cn.com.nr.service.NrRecordsService;


@Service("nrRecordsService")
public class NrRecordsServiceImpl extends ServiceImpl<NrRecordsMapper, NrRecordsEntity> implements NrRecordsService {
	@Autowired
	private NrRecordsMapper nrRecordsMapper;
	
	@Override
	public List<NrRecordsEntity> listLimit(List<String> stationinfoIdList, NrRecordsEntity nrRecords) throws ParseException {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		nrRecords.setCreateTimeEndDate(sdf.parse(nrRecords.getCreateTimeEnd() + " 00:00:00"));
		nrRecords.setCreateTimeStartDate(sdf.parse(nrRecords.getCreateTimeStart() + " 23:59:59"));
		
		return nrRecordsMapper.listLimit(stationinfoIdList,nrRecords);
	}

	@Override
	public List<NrRecordsEntity> listCount(List<String> stationinfoIdList, NrRecordsEntity nrRecords) throws ParseException {
		
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		nrRecords.setCreateTimeEndDate(sdf.parse(nrRecords.getCreateTimeEnd() + " 00:00:00"));
		nrRecords.setCreateTimeStartDate(sdf.parse(nrRecords.getCreateTimeStart() + " 23:59:59"));
		
		return nrRecordsMapper.listCount(stationinfoIdList,nrRecords);
	}


}